package com.dcyao.musicserve.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dcyao.musicserve.domain.Comment;
import com.dcyao.musicserve.domain.dto.CommentDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author admin
* @description 针对表【comment(评论)】的数据库操作Mapper
* @Entity com.xs.domain.CommentDTO
*/
@Mapper
public interface CommentMapper extends BaseMapper<Comment> {
    /**
     * 查看乐谱集的评论
     *
     * @param staffListId
     * @return
     */
    @Select(" SELECT consumer.username,consumer.avatar,comment.content,comment.id,comment.create_time FROM comment JOIN consumer ON comment.consumer_id=consumer.id WHERE comment.staff_list_id =#{staffListId }")
    List<CommentDTO> commentOfStaffListId(Integer staffListId);

    /**
     * 查看乐谱的评论
     *
     * @param staffId
     * @return
     */
    @Select(" SELECT consumer.username,consumer.avatar,consumer.sex,comment.content,comment.id,comment.create_time  FROM comment JOIN consumer ON comment.consumer_id=consumer.id WHERE comment.staff_id =#{staffId }")
    List<CommentDTO> commentOfStaffId(Integer staffId);




}
